﻿using System;

class CompareCharArrays

            // Write a program that compares two char arrays lexicographically (letter by letter).

{
    static void Main()
    {
        Console.Write("Enter the lenght of the arrays:");
        char [] arraySize = new char [int.Parse(Console.ReadLine())];
        string firstArray = "";
        string secondArray = "";
        Console.WriteLine();

        for (int i = 0; i < arraySize.Length; i++)
        {
            Console.Write("Enter the char on position {0} in the first array: ", i);
            arraySize[i] = char.Parse(Console.ReadLine());
            firstArray += arraySize[i];
        }
        Console.WriteLine();
        for (int i = 0; i < arraySize.Length; i++)
        {
            Console.Write("Enter the char on position {0} in the second array:", i);
            arraySize[i] = char.Parse(Console.ReadLine());
            secondArray += arraySize[i];
        }
 
        int result = string.Compare(firstArray, secondArray, StringComparison.CurrentCultureIgnoreCase);
 
        if (result == -1)
        {
            Console.WriteLine("First array is in fisrt position lexicographically.");
        }
        else if (result == 1)
        {
            Console.WriteLine("Second array is in fisrt position lexicographically.");
        }
        else
        {
            Console.WriteLine("The arrays are equal by lexicographically order.");
        } 
    } 
}

